<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Q&A</title>
    <head th:insert="~{import :: head}"></head>
    <script type="application/javascript">
        window.onload = function () {
            var closable = window.localStorage.getItem("closable");
            if (closable == "true") {
                window.close();
                window.localStorage.removeItem("closable");
            }
        }
    </script>
</head>
<body>
<div th:insert="~{head :: nav}"></div>
<div class="container-fluid main">
    <div class="row">
        <div class="col-xs-8 col-md-8 col-sm-8">
            <h2><span class="glyphicon glyphicon-list" aria-hidden="true"></span> 发现</h2>
            <div class="media" th:each="question : ${pagination.data}">
                <div class="media-left">
                    <a  th:if="${question.userInfo}!=null"  href="#">
                        <img class="media-object img-rounded" th:src="${question.userInfo.avatarUrl != null ? question.userInfo.avatarUrl:'/images/user.png' }">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                        <a th:href="@{'/question/'+ ${question.id}}" th:text="${question.title}"></a>
                    </h4>
                    <span class="text-desc"><img src="/images/revert.png" style="width: 15px; height: 15px;"/>（<span th:text="${question.commentCount}"></span>）<img src="/images/check.png" style="width: 15px; height: 15px;"/>（<span
                            th:text="${question.viewCount}"></span> ）<img src="/images/like.png" style="width: 15px; height: 15px;"/>（<span th:text="${question.thumbup}"></span>）<span
                            th:text="${#dates.format(question.gmtCreate,'yyyy-MM-dd HH:mm')}"></span></span>
                </div>
            </div>
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li th:if="${pagination.showFirstPage}">
                        <a th:href="@{/(page=1,search=${search},tag=${tag})}" aria-label="Previous">
                            <span aria-hidden="true">&lt;&lt;</span>
                        </a>
                    </li>
                    <li th:if="${pagination.showPrevious}">
                        <a th:href="@{/(page=${pagination.page - 1},search=${search},tag=${tag})}" aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>

                    <li th:each="page : ${pagination.pages}" th:class="${pagination.page == page}? 'active' : ''">
                        <a th:href="@{/(page=${page},search=${search},tag=${tag})}" th:text="${page}"></a>
                    </li>

                    <li th:if="${pagination.showNext}">
                        <a th:href="@{/(page=${pagination.page +1 },search=${search},tag=${tag})}" aria-label="Previous">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                    <li th:if="${pagination.showEndPage}">
                        <a th:href="@{/(page=${pagination.totalPage},search=${search},tag=${tag})}" aria-label="Previous">
                            <span aria-hidden="true">&gt;&gt;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
            <div class="col-xs-4 col-sm-4 col-md-4 ">
                <hr >
                <div>
                    <h4>热门问题</h4>
                    <div th:each="question : ${hotquestions}" style="margin: 20px" >
                        <h4 class="media-heading">
                            <a th:href="@{'/question/'+ ${question.id}}" th:text="${question.title}"></a>
                        </h4>
                    </div>
                </div>
            </div>
    </div>
    </div>
</div>
<div th:insert="~{footer :: foot}"></div>
<script src="/js/Live2D.js" type="application/javascript"></script>
</body>
</html>